package com.smc.common.exception;

/**
 * 服务异常
 *
 * @author zouqinghua
 * @date 2016年7月23日 下午12:02:41
 */
public class ServiceException extends RuntimeException {

  public static final int BAD_REQUEST_CODE = 400;
  public static final int UNAUTHORIZED_CODE = 401;
  public static final int FORBIDDEN_CODE = 403;
  public static final int NOT_FOUND_CODE = 404;
  public static final int SERVER_ERROR_CODE = 500;

  private static final long serialVersionUID = 1L;

  /** 注意: 这个 status 请遵循 HttpStatus !! */
  private int status;

  private int code;

  public ServiceException() {
    super();
  }

  public ServiceException(int status, int code, String message) {
    super(message);
    this.status = status;
    this.code = code;
  }

  public ServiceException(String message) {
    super(message);
  }

  public ServiceException(Throwable cause) {
    super(cause);
  }

  public ServiceException(String message, Throwable cause) {
    super(message, cause);
  }

  public int getStatus() {
    return status;
  }

  public void setStatus(int status) {
    this.status = status;
  }

  public int getCode() {
    return code;
  }

  public void setCode(int code) {
    this.code = code;
  }
}
